#!/bin/bash
OK=0
WARN=1
CRITICAL=2
UNKNOWN=3
PATH="/bin:/sbin:/usr/bin:/usr/sbin"
EPATH="/usr/lib64/nagios/plugins"

Ok_name=''
Fail_name=''
Judge=0
gfsmount=''

Judge=1
#    sudo /etc/init.d/filebeat stop
    el5=$(uname -a | grep el5 | wc -l)
    register=$(head -c 1 /var/lib/filebeat/registry)
    if [ "$register" != "[" ]; then
        sudo rm -f /var/lib/filebeat/registry
    fi
    #echo $register
    #echo $el5
    if [ $el5 -eq "0" ]; then
    	sudo /etc/init.d/filebeat start 
    else
    	sudo /usr/share/filebeat/restartfilebeat.sh 
    fi
exit $CRITICAL


